﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Core;
using System.Reflection;

namespace Crane.UnitTests.NUnitExtensions
{
    public class TreeConstructionTestSuite : TestSuite
    {
		private static string GetParentName(MethodInfo method)
		{
			if (method == null)
				throw new ArgumentNullException("method");
			
			return method.DeclaringType.ToString();
		}
		
		private static string GetTestName(MethodInfo method)
		{
			if (method == null)
				throw new ArgumentNullException("method");
			
			return method.Name;
		}

        public TreeConstructionTestSuite(MethodInfo method)
            : base(GetParentName(method), GetTestName(method))
        {
        }

        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            if (this.Parent != null)
                this.Fixture = this.Parent.Fixture;

            return base.Run(listener, filter);
        }

        protected override void DoOneTimeSetUp(TestResult suiteResult)
        {
        }

        protected override void DoOneTimeTearDown(TestResult suiteResult)
        {
        }
    }
}
